//
//  URLManager.h
//  ShenWeiRent
//
//  Created by iMac on 2019/3/1.
//  Copyright © 2019年 liyefu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking.h>
#import <AFHTTPSessionManager.h>
#import "BaseEntity.h"

NS_ASSUME_NONNULL_BEGIN

@interface URLManager : AFHTTPSessionManager

+ (instancetype)shareManager;

/**
 * 不带实例解析的POST请求
 */
- (void)postUrlStr:(NSString *)urlStr
        parameters:(nullable id)parameters
           success:(void (^)(NSURLResponse * _Nonnull response, id _Nullable responseObj, NSDictionary * _Nullable otherResponse))success
           failure:(void (^)(NSURLResponse * _Nullable response, NSError * _Nonnull error))failure;

/**
 * 带实例解析的POST请求
 */
- (void)postUrlStr:(NSString *)urlStr
        parameters:(nullable id)parameters
       entityClass:(Class)entityClass
           success:(void (^)(NSURLResponse * _Nonnull response, BaseEntity * _Nullable baseEntity, NSDictionary * _Nullable otherResponse))success
           failure:(void (^)(NSURLResponse * _Nullable response, NSError * _Nonnull error))failure;

/**
 * 不带实例解析的GET请求
 */
- (void)getUrlStr:(NSString *)urlStr
       parameters:(nullable id)parameters
          success:(void (^)(NSURLResponse * _Nonnull response, id _Nullable responseObj, NSDictionary * _Nullable otherResponse))success
          failure:(void (^)(NSURLResponse * _Nullable response, NSError * _Nonnull error))failure;

/**
 * 带实例解析的GET请求
 */
- (void)getUrlStr:(NSString *)urlStr
       parameters:(id)parameters
      entityClass:(Class)entityClass
          success:(void (^)(NSURLResponse * _Nonnull response, BaseEntity * _Nullable baseEntity, NSDictionary * _Nullable otherResponse))success
          failure:(void (^)(NSURLResponse * _Nullable response, NSError * _Nonnull error))failure;

/**
 * 上传图片
 */
- (void)uploadUrlStr:(NSString *)urlStr
              images:(NSArray *)images
          parameters:(nullable id)parameters
        fileDataName:(NSString *)fileDataName
             success:(void (^)(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObj))success
             failure:(void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;

@end

NS_ASSUME_NONNULL_END
